// 用户操作界面
import info from "../pages/info.js";
import Login from '../pages/login.js';
import Reg from "../pages/reg.js";

// 路由列表，里面配置的是url 和view 之间的映射关系
var routes = {
    "/login": () => new Login({ el: '#app' }),
    "/reg": () => new Reg({ el: '#app' }),
    "/info": {
        on() {
            if ($(".info-content").length === 1) return
            new info({ el: "#app" })
        },
    }
}
// forward是先执行一级内容再执行二级内容 backward先执行二级在执行以及
var router = Router(routes).configure({ recurse: "forward" });

export const init = () => {
    router.init();
    location.hash = location.hash || "#/login"
}